package cn.lingyangwl.agile.misc.statistic.service;

import cn.lingyangwl.agile.misc.statistic.mapper.*;
import cn.lingyangwl.agile.misc.statistic.model.entity.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author shenguangyang
 */
@Service
public class StatHourRecordServiceImpl extends ServiceImpl<StatHourRecordMapper, StatHourRecord>
    implements StatHourRecordService {

    @Override
    public void saveData(String groupFieldValue, LocalDateTime nowDate, List<StatHourRecord> record) {
        LambdaQueryWrapper<StatHourRecord> lqw = StatHourRecord.lqw().eq(StatHourRecord::getStatDate, nowDate);
        this.remove(lqw);
        this.saveBatch(record);
    }
}
